package com.study.ssm.annotation02.yaml;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhoujunlin
 * @date 2023年07月27日 10:26
 * @desc
 */
@Data
@Component
@PropertySource(value = "classpath:annotation02/init.yaml", /*name = "account",*/ factory = YamlPropertySourceFactory.class)
public class Account {

    @Value("${account.name}")
    private String name;

    @Value("${account.password}")
    private String password;

    /**
     * spring框架不能读取 yaml中的集合配置   springboot可以
     * 所以没有办法只能在yaml中写逗号分割的字符串
     */
    @Value("#{'${list}'.split(',')}")
    private List<String> list;

}
